package com.linewell.license.demo.designPattern.createPattern.SingletonPattern;

/**
 * @Title: springBootDemo
 * @description:  懒加载单例模式，
 * @author: hyuhuang@linewell.com
 * @since:2019/11/22
 */
public class Mouse {
    private static class SingletonHolder {
        private static final Mouse INSTANCE = new Mouse();
    }
    private Mouse (){}

    /**
     * 当执行getInstance的时候才会去加载这个单例，类被加载的时候不会被初始化
     * @return 单例
     */
    public static final Mouse getInstance() {
        return SingletonHolder.INSTANCE;
    }
}
